/*************************************************
Author: will
Date: 11/17/2012
Description:
Notes: 
*************************************************/

#ifndef __CCmdMainctrlInitData_h__
#define __CCmdMainctrlInitData_h__

#include "CTAsyncCmd.h"
#include "commerrno.h"

class CMainCtrl;
class CCmdMainctrlInitData : public CTLib::CTAsyncCmd
{
private:
    enum INIT_STAT
    {
        INIT_STAT_BEGIN = 1,

        INIT_STAT_FLUSH_DATA = INIT_STAT_BEGIN,
        INIT_STAT_ZONE_COUNT = 2,   //大区记录数
        INIT_STAT_ZONE_DATA = 3,
        INIT_STAT_MAX_PLAYER_ID = 4,

        INIT_STAT_SNS_COMM_INFO_COUNT = 5,
        INIT_STAT_SNS_COMM_INFO = 6,

        //初始化排名数据
        INIT_STAT_ARENA_RANK_COUNT = 7,           
        INIT_STAT_ARENA_RANK = 8,           

        //初始化家族数据
        INIT_STAT_CLAN_DATA_COUNT = 9,
        INIT_STAT_CLAN_DATA = 10,

        //恢复在线状态
        INIT_STAT_ONLINE_DATA = 11,

        //从角色数据上获取数据
        INIT_STAT_GET_DATA_FROM_DETAIL_EX1 = 12, 

        //遍历base info 
        INIT_STAT_GET_DATA_FROM_BASE_INFO = 13, 

        //遍历sns detail info
        INIT_STAT_GET_DATA_FROM_SNS_DETAIL_INFO = 14,
    };

public:
    CCmdMainctrlInitData()
        :_iNowStat(INIT_STAT_BEGIN)
    {
        _iDataIndex = -1;
    }

    virtual int Do(void* pData);
    virtual int CallBack(int iRet);

    CMainCtrl* pstMainCtrl;

private:
    int SendReq();

    int CheckRet(int iRet)
    {
        if (iRet != RET_OK)
        {
            return Done(iRet);
        }

        return iRet;
    }

    int _iNowStat;          //当前准备到哪些数据

    int64 _i64LeftSnsCommInfoCount;    
    int64 _i64LeftArenaUserCount;
    int64 _i64LeftClanDataCount;
    int   _iDataIndex;
    int64 _i64ZoneCount;
};


#endif // __CCmdMainctrlInitData_h__

